package day17.login.dao.impl;

import java.util.ArrayList;

import day17.login.dao.UserDao;
import day17.login.pojo.User;

public class UserDaoImpl implements UserDao {

    private static ArrayList<User> array = new ArrayList<User>();

    @Override
    public boolean isLogin(String username, String password) {
        boolean flag = false;

        for (User user : array){
            if (user.getUsername().equals(username)
                && user.getPassword().equals(password)) {
                    flag = true;
                    break;
                }
        }
        return flag;
    }

    @Override
    public void regist(User user) {
        array.add(user);        
    }
    
}
